#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
int main()
{
	char* pch = (char*)malloc(2000000);
	int i = 0;
	for (i = 1; i < 2000000; i++)
	{
		pch[i] = '1';
	}

	int n = 0;
	scanf("%d", &n);
	for (i = 0; i < n; i++)
	{
		double a = 0;
		int t = 0;
		scanf("%lf%d", &a, &t);
		int j = 0;
		for (j = 1; j <= t; j++)
		{
			pch[(int)(a * j) / 1] *= -1;
		}
	}
	for (i = 1; i < 2000000; i++)
	{
		if (pch[i] == -'1')
		{
			printf("%d", i);
			return 0;
		}
	}
	return 0;
}

